package main

import (
	"fmt"
)

type Car interface{

	Say() int
}


type Bmw struct{
	Price	int
}

type Audi struct{

	Price	int
	Name	string
}

func (this Bmw)Say() int{
	fmt.Println("i am cost ", this.Price)
	return this.Price
}

func (this Audi)Say() int{
	fmt.Printf("i am cost %d, my name is %s\n", this.Price, this.Name)
	return this.Price
}


func total(cars []Car) int{
	sum := 0
	for _,v := range cars{
		sum = sum + v.Say()
	}
	return sum
}

func main(){

	bmw := Bmw{Price: 200}
	audi := Audi{Price: 500, Name: "A4"}
	//cars := []Car{bmw, audi}
	var cars []Car
	cars = append(cars, bmw, audi)
	fmt.Println(total(cars))

}
